package com.sh.rpc.registry;

import com.sh.rpc.spi.SpiLoader;

/**
 * 注册中心工厂
 * @author sh
 */
public class RegistryFactory {

    static {
        SpiLoader.load(Registry.class);
    }


    // 默认注册中心
    private static final Registry DEFAULT_REGISTRY = new EtcdRegistry();

    // 获取注册中心
    public static Registry getInstance(String key){
        Registry registry = SpiLoader.getInstance(Registry.class, key);
        return registry==null ? DEFAULT_REGISTRY : registry;
    }



}
